import React, { useState } from 'react';
import ReactDOM from 'react-dom/client';
import './app.css'

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);

interface HeaderProps{
  title: string
}

// 2. 接收
function Header(prop: HeaderProps){
  return <>
  {/* 3. 使用 */}
  <div className="header">{prop.title}</div>
  </>
}

export default function App() {
  return <>
  {/* 1. 传递 */}
  <Header title = '标题'></Header>
  <div>我是根组件</div>
  </>
}



